package com.huadao.cart_ccs.modle;

import com.huadao.cart_ccs.base.BaseSerialPortModel;
import com.huadao.cart_ccs.common.ByteUtils;
import com.huadao.cart_ccs.data.bo.CommandWord;
import com.huadao.cart_ccs.data.bo.Protocol;
import com.huadao.cart_ccs.data.bo.ValveBO;

public class ValveModle extends BaseSerialPortModel {

    public void openMediumValve(){
        Protocol params= ByteUtils.generateProtocol(CommandWord.write,new byte[]{ValveBO.ModularType_Valve,ValveBO.Valve_medium,ValveBO.open},null);
        serialPortRequest(params);
    }

    public void closeMediumValve(){
        Protocol params= ByteUtils.generateProtocol(CommandWord.write,new byte[]{ValveBO.ModularType_Valve,ValveBO.Valve_medium,ValveBO.close},null);
        serialPortRequest(params);
    }

    public void openSalineValve(){
        Protocol params= ByteUtils.generateProtocol(CommandWord.write,new byte[]{ValveBO.ModularType_Valve,ValveBO.Valve_saline,ValveBO.open},null);
        serialPortRequest(params);
    }

    public int closeSalineValve(){
        Protocol params= ByteUtils.generateProtocol(CommandWord.write,new byte[]{ValveBO.ModularType_Valve,ValveBO.Valve_saline,ValveBO.close},null);
        return serialPortRequest(params);
    }

    public void openShakerValve(){
        Protocol params= ByteUtils.generateProtocol(CommandWord.write,new byte[]{ValveBO.ModularType_Valve,ValveBO.Valve_shaker,ValveBO.open},null);
        serialPortRequest(params);
    }

    public void closeShakerValve(){
        Protocol params= ByteUtils.generateProtocol(CommandWord.write,new byte[]{ValveBO.ModularType_Valve,ValveBO.Valve_shaker,ValveBO.close},null);
        serialPortRequest(params);
    }
}
